﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Shell;
using System.IO;
using System.IO.IsolatedStorage;
using System.Linq;
using System.Xml.Linq;

namespace BackAgent
{
    public static class LiveTileHelper
    {
        public static  void UpdateTile()
        {

            ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault();
            if (tile != null)
            {
                StandardTileData initialData = new StandardTileData();
                string lat =IsolatedSettings.getSettingsStringValue("lat");
                string lon = IsolatedSettings.getSettingsStringValue("long");
                initialData = new StandardTileData
                {
                    BackgroundImage = new Uri(@"http://tiles.virtualearth.net/api/GetMap.ashx?c="+lat+","+lon+"+&w=173&h=173&b=r,stl.h,device.mobile,mkt.en-US&z=5&logo=no&da=n"),

                };
                tile.Update(initialData);

            }
        }
       
    }

}

